<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Đặng Khánh Trung
 * Date: 11/2/12
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.multiselect');
JHtml::_('behavior.mootools');

$document = JFactory::getDocument();

$item = $this->get('item');
$canbos = $this->get('canbos');
$donvi = $this->get('donvi');
$khoi = $this->get('khoi');
$hosocanbo = VastHelper::getHosocanbo();
$donvilanhdao = VastHelper::getDonViLanhDao();
if (!JFactory::getUser()->authorise('vast.hosocanbo.edit', 'com_vast') 
    && !(JFactory::getUser()->authorise('vast.hosocanbo.edit.own') && $hosocanbo != NULL && $hosocanbo->nguoidung_id == JFactory::getUser()->id)
    && !(isset($donvilanhdao) && $donvilanhdao !== NULL && $donvilanhdao->donviid == $donvi->id))
{
    JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_vast&view=vast'));                        
}
?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Cơ cấu tổ chức</span> »
        <?php if (isset($khoi)): ?>        
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvitructhuoc&id=' . $khoi->id); ?>"><?php echo $khoi->ten ?></a> »                
        <?php endif; ?>
        <?php if (isset($donvi)): ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phongtructhuocs&id=' . $donvi->id); ?>"><?php echo $donvi->ten ?></a> »
        <?php endif; ?>
        <span>Sửa diễn biến lương cho cán bộ</span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Sửa lương cho cán bộ trong đơn vị <?php echo $donvi->ten; ?></h3>
    
    <div class="form">
        <form class="commentform form-validate" action="<?php echo JRoute::_('index.php?option=com_vast&view=dienbienluongcanbodonvi&layout=edit&dienbienluongid=' . $item['id'] . '&id=' . $item['hosocanbo_id'] . '&donviid=' . $donvi->id); ?>" method="post" id="dienbienluongcanbodonvi" name="adminForm">
            
            <div class="row">
                <?php echo $this->form->getLabel('id'); ?>
                <?php echo $this->form->getInput('id'); ?>
            </div>
                    
            <div class="row">
                <label class="hasTip" title="Cán bộ nhận mức lương mới">Cán bộ</label>
                <?php if (count($canbos) > 0): ?>
                <select disabled="disabled" name="hosocanbo_id" id="hosocanbo_id">
                    <?php foreach ($canbos as $canbo): ?>
                        <?php if ($canbo->id == JRequest::getInt('id')): ?>
                            <option selected="selected" value="<?php echo $canbo->id; ?>"><?php echo $canbo->hoten; ?></option>
                        <?php else: ?>
                            <option value="<?php echo $canbo->id; ?>"><?php echo $canbo->hoten; ?></option>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </select>
                <?php endif; ?>
            </div>
            
            <div class="row">
                <?php echo $this->form->getLabel('hesoluong_id'); ?>
                <?php echo $this->form->getInput('hesoluong_id'); ?>
            </div>

            <div class="row">
                <input type="hidden" name="option" value="com_vast" />
                <input type="hidden" name="task" value="dienbienluongcanbodonvi.update" />
            </div>
            
            <div class="row buttons">
                <button type="submit" class="button validate" id="submit"><?php echo JText::_('Cập nhật diễn biến lương'); ?></button>
                <?php echo JHtml::_('form.token'); ?>
            </div>
        </form>
    </div>
</div>